package cn.zyq.ykb.system.pay.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "pay.ali")
public class PayAliProperties {

    /**
     * 商户私钥
     */
    public static String privateKey;


    /**
     * 支付宝公钥字符串
     */
    public static String alipayPublicKey;

    /**
     * 支付回调地址
     * 注意，支付渠道统一回调到 payNotifyUrl 地址，由支付模块统一处理；然后，自己的支付模块，在回调 PayAppDO.payNotifyUrl 地址
     */
    public static String payNotifyUrl;

    /**
     * 开放平台上创建的移动应用的 ID
     */
    public static String androidAppid;

    /**
     * app商户私钥
     */
    public static String androidPrivateKey;

    /**
     * 支付宝公钥字符串
     */
    public static String androidAlipayPublicKey;
    /**
     * 渠道费率
     */
    public static int feeRate;
    // ========== 证书模式 ==========
    /**
     * 指定商户公钥应用证书内容字符串
     */
    // @NotBlank(message = "指定商户公钥应用证书内容不能为空", groups = {ModeCertificate.class})
    public static String appCertContent;
    /**
     * 指定支付宝公钥证书内容字符串
     */
    // @NotBlank(message = "指定支付宝公钥证书内容不能为空", groups = {ModeCertificate.class})
    public static String alipayPublicCertContent;
    /**
     * 指定根证书内容字符串
     */
    // @NotBlank(message = "指定根证书内容字符串不能为空", groups = {ModeCertificate.class})
    public static String rootCertContent;

    public void setPrivateKey(String privateKey) {
        PayAliProperties.privateKey = privateKey;
    }

    public void setAlipayPublicKey(String alipayPublicKey) {
        PayAliProperties.alipayPublicKey = alipayPublicKey;
    }

    public void setPayNotifyUrl(String payNotifyUrl) {
        PayAliProperties.payNotifyUrl = payNotifyUrl;
    }

    public void setAndroidAppid(String androidAppid) {
        PayAliProperties.androidAppid = androidAppid;
    }

    public void setAndroidPrivateKey(String androidPrivateKey) {
        PayAliProperties.androidPrivateKey = androidPrivateKey;
    }

    public void setAndroidAlipayPublicKey(String androidAlipayPublicKey) {
        PayAliProperties.androidAlipayPublicKey = androidAlipayPublicKey;
    }

    public void setFeeRate(int feeRate) {
        PayAliProperties.feeRate = feeRate;
    }

    public void setAppCertContent(String appCertContent) {
        PayAliProperties.appCertContent = appCertContent;
    }

    public void setAlipayPublicCertContent(String alipayPublicCertContent) {
        PayAliProperties.alipayPublicCertContent = alipayPublicCertContent;
    }

    public void setRootCertContent(String rootCertContent) {
        PayAliProperties.rootCertContent = rootCertContent;
    }
}
